package icu.d4peng.cloud.common.core;

import icu.d4peng.cloud.common.core.util.ExecutorFactory;
import icu.d4peng.cloud.common.core.util.OrikaFactory;
import icu.d4peng.cloud.common.core.util.SpringIocUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;

/**
 * @author d4peng
 * @version 1.0.0
 * @date 2021-12-23 20:49
 * @description CoreAutoConfiguration:核心包自动配置
 */
@Configuration
public class CoreAutoConfiguration {
    @ConditionalOnMissingBean({SpringIocUtils.class})
    @Bean
    public SpringIocUtils springIocUtil() {
        return new SpringIocUtils();
    }

    @ConditionalOnMissingBean({ExecutorService.class})
    @Bean
    public ExecutorService executorService() {
        return ExecutorFactory.build();
    }

    @ConditionalOnMissingBean({OrikaFactory.class})
    @Bean
    public OrikaFactory orikaFactory() {
        return new OrikaFactory();
    }
}
